package com.qiao.glod.ui.activity;

import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.qiao.glod.R;
import com.qiao.glod.util.StatusBarCompact;

/**
 * Created by Qiao on 2016/4/7.
 * function：滚动效果Activity
 */
public class QActivity extends AppCompatActivity implements View.OnClickListener {
    protected View mRootView;
    protected Toolbar mToolbar;

    @Override
    public void setContentView(int layoutResID) {
        mRootView = View.inflate(this,layoutResID,null);
        super.setContentView(mRootView);
        initViews();
    }

    @Override
    public void setContentView(View view) {
        mRootView = view;
        super.setContentView(mRootView);
        initViews();
    }

    protected  void initViews(){
        StatusBarCompact.setColor(this,getResources().getColor(R.color.colorPrimary),0x50);
        mToolbar = findView(R.id.toolbar);
        if(mToolbar!=null) {
            setSupportActionBar(mToolbar);
            getSupportActionBar().setHomeButtonEnabled(true);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
    }

    protected <T extends View> T findView(int resId) {
        return (T) findViewById(resId);
    }

    @Override
    public void onClick(View v) {

    }
}
